package model.dtos;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Team
{
	String code;
	String name;
	String city;
	String stadiumName;
	Date foundedDate;
	List<Player> players;
	int playedGames;
	int lostGames;
	int wonGames;
	
	public Team()
	{
		 players = new ArrayList<Player>();
	}
	
	public Team(String code, String name, String city, 
			String stadiumName, Date foundedDate)
	{
		super();
		this.code = code;
		this.name = name;
		this.city = city;
		this.stadiumName = stadiumName;
		this.foundedDate = foundedDate;
		this.players = new ArrayList<Player>();
		this.lostGames = 0;
		this.wonGames = 0;
		
	}
	
	public Team(String code, String name, String city, String stadiumName,
			Date foundedDate, int playedGames, int lostGames, int wonGames)
	{
		super();
		this.code = code;
		this.name = name;
		this.city = city;
		this.stadiumName = stadiumName;
		this.foundedDate = foundedDate;
		this.players = new ArrayList<Player>();
		this.playedGames = playedGames;
		this.lostGames = lostGames;
		this.wonGames = wonGames;
	}

	public Team(String code, String name, String city, String stadiumName,
			Date foundedDate, List<Player> players, int playedGames,
			int lostGames, int wonGames)
	{
		super();
		this.code = code;
		this.name = name;
		this.city = city;
		this.stadiumName = stadiumName;
		this.foundedDate = foundedDate;
		this.players = players;
		this.playedGames = playedGames;
		this.lostGames = lostGames;
		this.wonGames = wonGames;
	}

	public String getCode()
	{
		return code;
	}

	public void setCode(String code)
	{
		this.code = code;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getCity()
	{
		return city;
	}

	public void setCity(String city)
	{
		this.city = city;
	}

	public String getStadiumName()
	{
		return stadiumName;
	}

	public void setStadiumName(String stadiumName)
	{
		this.stadiumName = stadiumName;
	}

	public Date getFoundedDate()
	{
		return foundedDate;
	}

	public void setFoundedDate(Date foundedDate)
	{
		this.foundedDate = foundedDate;
	}

	public List<Player> getPlayers()
	{
		return players;
	}

	public void setPlayers(List<Player> players)
	{
		this.players = players;
	}

	public int getPlayedGames()
	{
		return this.lostGames + this.wonGames;
	}

	public int getLostGames()
	{
		return lostGames;
	}
	
	public void addWonGame()
	{
		this.wonGames++;
	}
	
	public void addLostGame()
	{
		this.lostGames++;
	}

	public void setLostGames(int lostGames)
	{
		this.lostGames = lostGames;
	}

	public int getWonGames()
	{
		return wonGames;
	}

	public void setWonGames(int wonGames)
	{
		this.wonGames = wonGames;
	}
	
	public void addPlayer (Player player)
	{
		this.players.add(player);
	}
	
	@Override
	public String toString()
	{
		return this.name;
	}
}
